package myPack1;

import java.util.concurrent.TimeUnit;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;

public class Pragyatest {
	WebDriver driver;
	String url;
	@Before
	public void launchBrowser()
	{
		driver = new FirefoxDriver();
		driver.manage().window().maximize(); 
		url = "http://www.guru.com/";
				
	}
@Test
public void Test() throws Exception
{
driver.get(url);
driver.manage().timeouts().implicitlyWait(45, TimeUnit.SECONDS);

driver.findElement(By.id("topnav-postjob")).click(); 
driver.findElement(By.id("ctl00_guB_ucPostProject_txtPT_txtPT_TextBox")).sendKeys("Testing");
driver.findElement(By.id("ctl00_guB_ucPostProject_txtPD_txtPD_TextBox")).sendKeys("sDASDDADfdgdfgfdhfghjgfjhg54364645");
driver.findElement(By.id("topnav-findservices")).click(); 
driver.findElement(By.id("selectAll")).click(); 
Thread.sleep (3000);
Select dropdown = new Select(driver.findElement(By.id("ctl00_guB_ddlSkills")));
dropdown.selectByValue("227");

driver.findElement(By.id("topnav-postjob")).click(); 
driver.findElement(By.id("ctl00_guB_ucPostProject_txtPT_txtPT_TextBox")).sendKeys("Testing");
driver.findElement(By.id("ctl00_guB_ucPostProject_txtPD_txtPD_TextBox")).sendKeys("sDASDDADfdgdfgfdhfghjgf46gdfhfh!#!#!jhg54364645");

driver.findElement(By.id("btnAddWork")).click();
Thread.sleep(2000);
driver.findElement(By.xpath("//button[@class = 'close closeTheModal']")).click();
//driver.switchTo().frame(driver.findElement(By.xpath("//*[@id='ctl00_guB_ucPostProject_txtCountry_txtCountry_DefaultText']")));
driver.findElement(By.id("addWorkLabel"));
driver.findElement(By.className("close closeTheModal")).click();
driver.findElement(By.id("cancelPopup")).click();
driver.findElement(By.id("ctl00_guB_ucPostProject_rblLocationType_rblLocationType_RadioButton_1")).click();
driver.findElement(By.xpath("//*[@id='ctl00_guB_ucPostProject_txtCountry_txtCountry_DefaultText']")).sendKeys("india");
Thread.sleep (2000);
System.out.println("test");

}

@After

public void After(){
{
driver.close();
}}
}

